package richbar.com.richbar.activity.me;
import android.view.View;
import android.widget.TextView;
import com.common.base.BaseActivity;
import com.okhttp.GlideUtil;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import richbar.com.richbar.R;
import richbar.com.richbar.help.TitleHelp;
import richbar.com.richbar.view.dialog.TipDialog;

/**
 * Created by QiYang on 2018/11/16.
 */

public class AboutAppAc extends BaseActivity {
    @BindView(R.id.cache)
    TextView cache;

    @Override
    public int initLayout() {
        return R.layout.ac_about_app;
    }

    @Override
    public void initTitle() {
        new TitleHelp(this).setTitle("关于APP");
    }

    @Override
    public void initView() {
        ButterKnife.bind(this);
        cache.setText(GlideUtil.getInstance().getCacheSize(this));
    }

    @Override
    public void initData() {

    }

    @OnClick({R.id.clear_cache_body, R.id.version_body})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.clear_cache_body:
                TipDialog.show(AboutAppAc.this, "确定清除本地缓存？", new TipDialog.OnListener() {
                    @Override
                    public void onBesure() {
                        GlideUtil.getInstance().clearImageAllCache(AboutAppAc.this);
                        cache.setText("0M");
                    }
                });
                break;
            case R.id.version_body:
                start(VersionAc.class);
                break;
        }
    }
}
